#ifndef STATICINDEXARRAY_H_
#define STATICINDEXARRAY_H_

#include "db/indexarray.hxx"
#include <pthread.h>

/**
 * the size of index array cannot be changed dynamically. 
 */ 
class StaticIndexArray : public IndexArray {

public:
    StaticIndexArray(const std::string& partitionPath, uint32_t indexArrayCapacity);
    ~StaticIndexArray();

    //get/set index array
    DbStatus get(uint32_t index, uint64_t& value);
    DbStatus set(uint32_t index, uint64_t value, uint64_t scn);

    //for compaction only, compact doesn't write log, so we cannot change hwm scn
    DbStatus set(uint32_t index, uint64_t value);

    DbStatus init();
    DbStatus flush();

    uint32_t getCapacity() {return m_capacity;}

    void setWaterMarks(uint64_t lwm, uint64_t hwm)
    {
        m_indexArrayFile->setWaterMarks(lwm, hwm);
    }

    void getWaterMarks(uint64_t& lwm, uint64_t& hwm)
    {
        m_indexArrayFile->getWaterMarks(lwm, hwm);
    }

    DbStatus applyEntries();
    void switchEntries();
};

#endif
